/*河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
*/
package cn.javaxc.mes.action.systemadmin;
import java.io.*;
import java.util.*;
import java.sql.*;
import cn.javaxc.model.base.SQL;
import cn.javaxc.model.base.SQLList;
import cn.javaxc.model.base.SQLMap;
import cn.javaxc.model.base.SQLParam;
import cn.javaxc.model.page.BatisPage;
import cn.javaxc.mvcwork.controller.web.TreeBean;
import cn.javaxc.mvcwork.util.common.CommonUtil;
import cn.javaxc.mvcwork.util.common.MapListUtil;
import cn.javaxc.mvcwork.util.helper.FrameHelper;
import cn.javaxc.mvcwork.util.helper.TreeTableHelper;
import org.springframework.beans.factory.annotation.Autowired;
import cn.javaxc.system.action.base.BaseAction;
import cn.javaxc.mes.mapper.systemadmin.ReportAdminMapper;
public class ReportAdminAction extends BaseAction
{
    @Autowired(required=false)
	private ReportAdminMapper mapper;
    /**
    报表统计
    */
    
    public Map reportList() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_report=mapper.s_report(params);
        result.put("s_report", s_report);
        
        return result;
    }
    /**
    报表明细
    */
    
    public Map reportDetail() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_report=mapper.s_report(params);
        SQLMap s_report_emt=s_report.getExistfirst();
        result.put("s_report", s_report_emt);
        
        
        SQLList<SQLMap> s_params=mapper.s_params(params);
        result.put("s_params", s_params);
        
        
        SQLList<SQLMap> s_list=mapper.s_list(params);
        result.put("s_list", s_list);
        
        return result;
    }
    /**
    修改报表
    */
    
    public Map reportUpdate() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_report=mapper.s_report(params);
        SQLMap s_report_emt=s_report.getExistfirst();
        result.put("s_report", s_report_emt);
        
        
        SQLList<SQLMap> s_params=mapper.s_params(params);
        result.put("s_params", s_params);
        
        
        SQLList<SQLMap> s_list=mapper.s_list(params);
        result.put("s_list", s_list);
        
        return result;
    }
    /**
    报表sql
    */
    
    public Map reportData() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_report=mapper.s_report(params);
        SQLMap s_report_emt=s_report.getExistfirst();
        result.put("s_report", s_report_emt);
        
        
        context.setAttribute("get_report",new SQLList(get_report().getExistfirst()));
        
        
        SQLList<SQLMap> s_params=mapper.s_params(params);
        result.put("s_params", s_params);
        
        
        SQLList<SQLMap> s_list=mapper.s_list(params);
        result.put("s_list", s_list);
        
        return result;
    }
    /**
    报表结果
    */
    
    public Map reportResult() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_params=mapper.s_params(params);
        result.put("s_params", s_params);
        
        
        SQLList<SQLMap> columnNames=mapper.columnNames(params);
        result.put("columnNames", columnNames);
        
        return result;
    }
    /**
    */
    
    public Object s_list() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> t_report=mapper.t_report(params);
        SQLMap t_report_emt=t_report.getExistfirst();
        result.put("t_report", t_report_emt);
        
        
        SQLList<SQLMap> s_list=mapper.s_list(params);
        result.put("s_list", s_list);
        
        return s_list;
    }
    /**
    */
    
    public SQLList get_report() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        
        
        SQLList<SQLMap> s_report =buildExcelTitle(ReportAdminAction.class,"s_report");
        
        return s_report;
    }
    /**
    */
    
    public Map all_report() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> s_index=mapper.s_index(params);
        result.put("s_index", s_index);
        
        
        SQLList<SQLMap> s_chart3=mapper.s_chart3(params);
        result.put("s_chart3", s_chart3);
        
        
        SQLList<SQLMap> ts_account=mapper.ts_account(params);
        result.put("ts_account", ts_account);
        
        
        SQLList<SQLMap> product1=mapper.product1(params);
        result.put("product1", product1);
        
        
        SQLList<SQLMap> product2=mapper.product2(params);
        result.put("product2", product2);
        
        
        SQLList<SQLMap> product3=mapper.product3(params);
        result.put("product3", product3);
        
        return result;
    }
    /**
    图表显示
    */
    
    public Map reportChart() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        SQLList<SQLMap> t_report=mapper.t_report(params);
        SQLMap t_report_emt=t_report.getExistfirst();
        result.put("t_report", t_report_emt);
        
        
        SQLList<SQLMap> s_params=mapper.s_params(params);
        result.put("s_params", s_params);
        
        
        SQLList<SQLMap> columnNames=mapper.columnNames(params);
        result.put("columnNames", columnNames);
        
        
        SQLList<SQLMap> infomap=mapper.infomap(params);
        result.put("infomap", infomap);
        
        return result;
    }
    /**
    */
    
    public Map d_report() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.d_report(params);
        
        return result;
    }
    /**
    */
    
    public Map d_params() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.d_params(params);
        
        return result;
    }
    /**
    增加报表修改
    */
    
    public Map reportAddSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        if(getParameter("CMID")==null)insert();
        
        
        for (SQLMap emt:hqlBean.getTableElements("")){
            params=new SQLParam(request,emt.getMap());
            if(SQL.isNotNull(params.get("name")))
            mapper.reportAddSubmit(params);
        }
        
        return result;
    }
    /**
    */
    
    public Map insert() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int CMID = mapper.CMID(params);
        result.put("CMID", CMID);
        
        return result;
    }
    /**
    修改报表修改
    */
    
    public Map reportUpdateSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        int CMID = mapper.CMID(params);
        result.put("CMID", CMID);
        
        
        for (SQLMap emt:hqlBean.getTableElements("")){
            params=new SQLParam(request,emt.getMap());
            mapper.reportUpdateSubmit(params);
        }
        
        return result;
    }
    /**
    报表sql修改
    */
    
    public Map reportDataSubmit() {
        
        Map result=new HashMap();
        SQLParam params=new SQLParam(request,result);
        
        mapper.reportDataSubmit(params);
        
        
        for (SQLMap emt:hqlBean.getTableElements("report_params")){
            params=new SQLParam(request,emt.getMap());
            mapper.b_report_params(params);
        }
        
        return result;
    }
}